home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 2001 May / SGI Freeware 2001 May - Disc 2.iso / dist / fw_libmikmod.idb / usr / freeware / include / mikmod.h.z / mikmod.h
C/C++ Source or Header  |  2000-06-09  |  23KB  |  703 lines

  1. /*    MikMod sound library
  2.     (c) 1998, 1999, 2000 Miodrag Vallat and others - see file AUTHORS
  3.     for complete list.
  4.  
  5.     This library is free software; you can redistribute it and/or modify
  6.     it under the terms of the GNU Library General Public License as
  7.     published by the Free Software Foundation; either version 2 of
  8.     the License, or (at your option) any later version.
  9.  
  10.     This program is distributed in the hope that it will be useful,
  11.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.     GNU Library General Public License for more details.
  14.  
  15.     You should have received a copy of the GNU Library General Public
  16.     License along with this library; if not, write to the Free Software
  17.     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  18.     02111-1307, USA.
  19. */
  20.  
  21. /*==============================================================================
  22.  
  23.   $Id: mikmod.h.in,v 1.38 2000/02/14 22:10:21 miod Exp $
  24.  
  25.   MikMod sound library include file
  26.  
  27. ==============================================================================*/
  28.  
  29. #ifndef _MIKMOD_H_
  30. #define _MIKMOD_H_
  31.  
  32. #include <stdio.h>
  33. #include <stdlib.h>
  34.  
  35. #ifdef __cplusplus
  36. extern "C" {
  37. #endif
  38.  
  39. /*
  40.  * ========== Compiler magic for shared libraries
  41.  */
  42.  
  43. #if defined WIN32 && defined _DLL
  44. #ifdef DLL_EXPORTS
  45. #define MIKMODAPI __declspec(dllexport)
  46. #else
  47. #define MIKMODAPI __declspec(dllimport)
  48. #endif
  49. #else
  50. #define MIKMODAPI
  51. #endif
  52.  
  53. /*
  54.  *    ========== Library version
  55.  */
  56.  
  57. #define LIBMIKMOD_VERSION_MAJOR 3L
  58. #define LIBMIKMOD_VERSION_MINOR 1L
  59. #define LIBMIKMOD_REVISION      9L
  60.  
  61. #define LIBMIKMOD_VERSION \
  62.     ((LIBMIKMOD_VERSION_MAJOR<<16)| \
  63.      (LIBMIKMOD_VERSION_MINOR<< 8)| \
  64.      (LIBMIKMOD_REVISION))
  65.  
  66. MIKMODAPI extern long MikMod_GetVersion(void);
  67.  
  68. /*
  69.  *    ========== Platform independent-type definitions
  70.  */
  71.  
  72. #ifdef WIN32
  73. #define WIN32_LEAN_AND_MEAN
  74. #include <windows.h>
  75. #include <io.h>
  76. #endif
  77.  
  78. #if defined(__OS2__)||defined(__EMX__)
  79. #define INCL_DOSSEMAPHORES
  80. #include <os2.h>
  81. #else
  82. typedef char CHAR;
  83. #endif
  84.  
  85.  
  86.  
  87. #if defined(__alpha)
  88. /* 64 bit architectures */
  89.  
  90. typedef signed char     SBYTE;      /* 1 byte, signed */
  91. typedef unsigned char   UBYTE;      /* 1 byte, unsigned */
  92. typedef signed short    SWORD;      /* 2 bytes, signed */
  93. typedef unsigned short  UWORD;      /* 2 bytes, unsigned */
  94. typedef signed int      SLONG;      /* 4 bytes, signed */
  95. typedef unsigned int    ULONG;      /* 4 bytes, unsigned */
  96. typedef int             BOOL;       /* 0=false, <>0 true */
  97.  
  98. #else
  99. /* 32 bit architectures */
  100.  
  101. typedef signed char     SBYTE;      /* 1 byte, signed */
  102. typedef unsigned char   UBYTE;      /* 1 byte, unsigned */
  103. typedef signed short    SWORD;      /* 2 bytes, signed */
  104. typedef unsigned short  UWORD;      /* 2 bytes, unsigned */
  105. typedef signed long     SLONG;      /* 4 bytes, signed */
  106. #if !defined(__OS2__)&&!defined(__EMX__)&&!defined(WIN32)
  107. typedef unsigned long   ULONG;      /* 4 bytes, unsigned */
  108. typedef int             BOOL;       /* 0=false, <>0 true */
  109. #endif
  110. #endif
  111.  
  112. /*
  113.  *    ========== Error codes
  114.  */
  115.  
  116. enum {
  117.     MMERR_OPENING_FILE = 1,
  118.     MMERR_OUT_OF_MEMORY,
  119.     MMERR_DYNAMIC_LINKING,
  120.  
  121.     MMERR_SAMPLE_TOO_BIG,
  122.     MMERR_OUT_OF_HANDLES,
  123.     MMERR_UNKNOWN_WAVE_TYPE,
  124.  
  125.     MMERR_LOADING_PATTERN,
  126.     MMERR_LOADING_TRACK,
  127.     MMERR_LOADING_HEADER,
  128.     MMERR_LOADING_SAMPLEINFO,
  129.     MMERR_NOT_A_MODULE,
  130.     MMERR_NOT_A_STREAM,
  131.     MMERR_MED_SYNTHSAMPLES,
  132.     MMERR_ITPACK_INVALID_DATA,
  133.  
  134.     MMERR_DETECTING_DEVICE,
  135.     MMERR_INVALID_DEVICE,
  136.     MMERR_INITIALIZING_MIXER,
  137.     MMERR_OPENING_AUDIO,
  138.     MMERR_8BIT_ONLY,
  139.     MMERR_16BIT_ONLY,
  140.     MMERR_STEREO_ONLY,
  141.     MMERR_ULAW,
  142.     MMERR_NON_BLOCK,
  143.  
  144.     MMERR_AF_AUDIO_PORT,
  145.  
  146.     MMERR_AIX_CONFIG_INIT,
  147.     MMERR_AIX_CONFIG_CONTROL,
  148.     MMERR_AIX_CONFIG_START,
  149.  
  150.     MMERR_GUS_SETTINGS,
  151.     MMERR_GUS_RESET,
  152.     MMERR_GUS_TIMER,
  153.  
  154.     MMERR_HP_SETSAMPLESIZE,
  155.     MMERR_HP_SETSPEED,
  156.     MMERR_HP_CHANNELS,
  157.     MMERR_HP_AUDIO_OUTPUT,
  158.     MMERR_HP_AUDIO_DESC,
  159.     MMERR_HP_BUFFERSIZE,
  160.  
  161.     MMERR_OSS_SETFRAGMENT,
  162.     MMERR_OSS_SETSAMPLESIZE,
  163.     MMERR_OSS_SETSTEREO,
  164.     MMERR_OSS_SETSPEED,
  165.  
  166.     MMERR_SGI_SPEED,
  167.     MMERR_SGI_16BIT,
  168.     MMERR_SGI_8BIT,
  169.     MMERR_SGI_STEREO,
  170.     MMERR_SGI_MONO,
  171.  
  172.     MMERR_SUN_INIT,
  173.  
  174.     MMERR_OS2_MIXSETUP,
  175.     MMERR_OS2_SEMAPHORE,
  176.     MMERR_OS2_TIMER,
  177.     MMERR_OS2_THREAD,
  178.  
  179.     MMERR_DS_PRIORITY,
  180.     MMERR_DS_BUFFER,
  181.     MMERR_DS_FORMAT,
  182.     MMERR_DS_NOTIFY,
  183.     MMERR_DS_EVENT,
  184.     MMERR_DS_THREAD,
  185.     MMERR_DS_UPDATE,
  186.  
  187.     MMERR_WINMM_HANDLE,
  188.     MMERR_WINMM_ALLOCATED,
  189.     MMERR_WINMM_DEVICEID,
  190.     MMERR_WINMM_FORMAT,
  191.     MMERR_WINMM_UNKNOWN,
  192.  
  193.     MMERR_MAC_SPEED,
  194.     MMERR_MAC_START,
  195.  
  196.     MMERR_MAX
  197. };
  198.  
  199. /*
  200.  *    ========== Error handling
  201.  */
  202.  
  203. typedef void (MikMod_handler)(void);
  204. typedef MikMod_handler *MikMod_handler_t;
  205.  
  206. MIKMODAPI extern int  MikMod_errno;
  207. MIKMODAPI extern BOOL MikMod_critical;
  208. MIKMODAPI extern char *MikMod_strerror(int);
  209.  
  210. MIKMODAPI extern MikMod_handler_t MikMod_RegisterErrorHandler(MikMod_handler_t);
  211.  
  212. /*
  213.  *    ========== Library initialization and core functions
  214.  */
  215.  
  216. struct MDRIVER;
  217.  
  218. MIKMODAPI extern void   MikMod_RegisterAllDrivers(void);
  219.  
  220. MIKMODAPI extern CHAR*  MikMod_InfoDriver(void);
  221. MIKMODAPI extern void   MikMod_RegisterDriver(struct MDRIVER*);
  222. MIKMODAPI extern int    MikMod_DriverFromAlias(CHAR*);
  223.  
  224. MIKMODAPI extern BOOL   MikMod_Init(CHAR*);
  225. MIKMODAPI extern void   MikMod_Exit(void);
  226. MIKMODAPI extern BOOL   MikMod_Reset(CHAR*);
  227. MIKMODAPI extern BOOL   MikMod_SetNumVoices(int,int);
  228. MIKMODAPI extern BOOL   MikMod_Active(void);
  229. MIKMODAPI extern BOOL   MikMod_EnableOutput(void);
  230. MIKMODAPI extern void   MikMod_DisableOutput(void);
  231. MIKMODAPI extern void   MikMod_Update(void);
  232.  
  233. MIKMODAPI extern BOOL   MikMod_InitThreads(void);
  234. MIKMODAPI extern void   MikMod_Lock(void);
  235. MIKMODAPI extern void   MikMod_Unlock(void);
  236.  
  237. /*
  238.  *    ========== Reader, Writer
  239.  */
  240.  
  241. typedef struct MREADER {
  242.     BOOL (*Seek)(struct MREADER*,long,int);
  243.     long (*Tell)(struct MREADER*);
  244.     BOOL (*Read)(struct MREADER*,void*,size_t);
  245.     int  (*Get)(struct MREADER*);
  246.     BOOL (*Eof)(struct MREADER*);
  247. } MREADER;
  248.  
  249. typedef struct MWRITER {
  250.     BOOL (*Seek)(struct MWRITER*,long,int);
  251.     long (*Tell)(struct MWRITER*);
  252.     BOOL (*Write)(struct MWRITER*,void*,size_t);
  253.     BOOL (*Put)(struct MWRITER*,int);
  254. } MWRITER;
  255.  
  256. /*
  257.  *    ========== Samples
  258.  */
  259.  
  260. /* Sample playback should not be interrupted */
  261. #define SFX_CRITICAL 1
  262.  
  263. /* Sample format [loading and in-memory] flags: */
  264. #define SF_16BITS       0x0001
  265. #define SF_STEREO       0x0002
  266. #define SF_SIGNED       0x0004
  267. #define SF_BIG_ENDIAN   0x0008
  268. #define SF_DELTA        0x0010
  269. #define SF_ITPACKED        0x0020
  270.  
  271. #define    SF_FORMATMASK    0x003F
  272.  
  273. /* General Playback flags */
  274.  
  275. #define SF_LOOP         0x0100
  276. #define SF_BIDI         0x0200
  277. #define SF_REVERSE      0x0400
  278. #define SF_SUSTAIN      0x0800
  279.  
  280. #define SF_PLAYBACKMASK    0x0C00
  281.  
  282. /* Module-only Playback Flags */
  283.  
  284. #define SF_OWNPAN        0x1000
  285. #define SF_UST_LOOP     0x2000
  286.  
  287. #define SF_EXTRAPLAYBACKMASK    0x3000
  288.  
  289. /* Panning constants */
  290. #define PAN_LEFT       0
  291. #define PAN_CENTER   128
  292. #define PAN_RIGHT    255
  293. #define PAN_SURROUND 512 /* panning value for Dolby Surround */
  294.  
  295. typedef struct SAMPLE {
  296.     SWORD  panning;     /* panning (0-255 or PAN_SURROUND) */
  297.     ULONG  speed;       /* Base playing speed/frequency of note */
  298.     UBYTE  volume;      /* volume 0-64 */
  299.     UWORD  inflags;        /* sample format on disk */
  300.     UWORD  flags;       /* sample format in memory */
  301.     ULONG  length;      /* length of sample (in samples!) */
  302.     ULONG  loopstart;   /* repeat position (relative to start, in samples) */
  303.     ULONG  loopend;     /* repeat end */
  304.     ULONG  susbegin;    /* sustain loop begin (in samples) \  Not Supported */
  305.     ULONG  susend;      /* sustain loop end                /      Yet! */
  306.  
  307.     /* Variables used by the module player only! (ignored for sound effects) */
  308.     UBYTE  globvol;     /* global volume */
  309.     UBYTE  vibflags;    /* autovibrato flag stuffs */
  310.     UBYTE  vibtype;     /* Vibratos moved from INSTRUMENT to SAMPLE */
  311.     UBYTE  vibsweep;
  312.     UBYTE  vibdepth;
  313.     UBYTE  vibrate;
  314.     CHAR*  samplename;  /* name of the sample */
  315.  
  316.     /* Values used internally only */
  317.     UWORD  avibpos;     /* autovibrato pos [player use] */
  318.     UBYTE  divfactor;   /* for sample scaling, maintains proper period slides */
  319.     ULONG  seekpos;     /* seek position in file */
  320.     SWORD  handle;      /* sample handle used by individual drivers */
  321. } SAMPLE;
  322.  
  323. /* Sample functions */
  324.  
  325. MIKMODAPI extern SAMPLE *Sample_Load(CHAR*);
  326. MIKMODAPI extern SAMPLE *Sample_LoadFP(FILE*);
  327. MIKMODAPI extern SAMPLE *Sample_LoadGeneric(MREADER*);
  328. MIKMODAPI extern void   Sample_Free(SAMPLE*);
  329. MIKMODAPI extern SBYTE  Sample_Play(SAMPLE*,ULONG,UBYTE);
  330.  
  331. MIKMODAPI extern void   Voice_SetVolume(SBYTE,UWORD);
  332. MIKMODAPI extern UWORD  Voice_GetVolume(SBYTE);
  333. MIKMODAPI extern void   Voice_SetFrequency(SBYTE,ULONG);
  334. MIKMODAPI extern ULONG  Voice_GetFrequency(SBYTE);
  335. MIKMODAPI extern void   Voice_SetPanning(SBYTE,ULONG);
  336. MIKMODAPI extern ULONG  Voice_GetPanning(SBYTE);
  337. MIKMODAPI extern void   Voice_Play(SBYTE,SAMPLE*,ULONG);
  338. MIKMODAPI extern void   Voice_Stop(SBYTE);
  339. MIKMODAPI extern BOOL   Voice_Stopped(SBYTE);
  340. MIKMODAPI extern SLONG  Voice_GetPosition(SBYTE);
  341. MIKMODAPI extern ULONG  Voice_RealVolume(SBYTE);
  342.  
  343. /*
  344.  *    ========== Internal module representation (UniMod)
  345.  */
  346.  
  347. /*
  348.     Instrument definition - for information only, the only field which may be
  349.     of use in user programs is the name field
  350. */
  351.  
  352. /* Instrument note count */
  353. #define INSTNOTES 120
  354.  
  355. /* Envelope point */
  356. typedef struct ENVPT {
  357.     SWORD pos;
  358.     SWORD val;
  359. } ENVPT;
  360.  
  361. /* Envelope point count */
  362. #define ENVPOINTS 32
  363.  
  364. /* Instrument structure */
  365. typedef struct INSTRUMENT {
  366.     CHAR* insname;
  367.  
  368.     UBYTE flags;
  369.     UWORD samplenumber[INSTNOTES];
  370.     UBYTE samplenote[INSTNOTES];
  371.  
  372.     UBYTE nnatype;
  373.     UBYTE dca;              /* duplicate check action */
  374.     UBYTE dct;              /* duplicate check type */
  375.     UBYTE globvol;
  376.     UWORD volfade;
  377.     SWORD panning;          /* instrument-based panning var */
  378.  
  379.     UBYTE pitpansep;        /* pitch pan separation (0 to 255) */
  380.     UBYTE pitpancenter;     /* pitch pan center (0 to 119) */
  381.     UBYTE rvolvar;          /* random volume varations (0 - 100%) */
  382.     UBYTE rpanvar;          /* random panning varations (0 - 100%) */
  383.  
  384.     /* volume envelope */
  385.     UBYTE volflg;           /* bit 0: on 1: sustain 2: loop */
  386.     UBYTE volpts;
  387.     UBYTE volsusbeg;
  388.     UBYTE volsusend;
  389.     UBYTE volbeg;
  390.     UBYTE volend;
  391.     ENVPT volenv[ENVPOINTS];
  392.     /* panning envelope */
  393.     UBYTE panflg;           /* bit 0: on 1: sustain 2: loop */
  394.     UBYTE panpts;
  395.     UBYTE pansusbeg;
  396.     UBYTE pansusend;
  397.     UBYTE panbeg;
  398.     UBYTE panend;
  399.     ENVPT panenv[ENVPOINTS];
  400.     /* pitch envelope */
  401.     UBYTE pitflg;           /* bit 0: on 1: sustain 2: loop */
  402.     UBYTE pitpts;
  403.     UBYTE pitsusbeg;
  404.     UBYTE pitsusend;
  405.     UBYTE pitbeg;
  406.     UBYTE pitend;
  407.     ENVPT pitenv[ENVPOINTS];
  408. } INSTRUMENT;
  409.  
  410. struct MP_CONTROL;
  411. struct MP_VOICE;
  412.  
  413. /* Module flags */
  414. #define UF_XMPERIODS 0x0001 /* XM periods / finetuning */
  415. #define UF_LINEAR    0x0002 /* LINEAR periods (UF_XMPERIODS must be set) */
  416. #define UF_INST      0x0004 /* Instruments are used */
  417. #define UF_NNA       0x0008 /* IT: NNA used, set numvoices rather than numchn */
  418. #define UF_S3MSLIDES 0x0010 /* uses old S3M volume slides */
  419. #define UF_BGSLIDES  0x0020 /* continue volume slides in the background */
  420. #define UF_HIGHBPM   0x0040 /* MED: can use >255 bpm */
  421. #define UF_NOWRAP    0x0080 /* XM-type (i.e. illogical) pattern brk semantics */
  422. #define UF_ARPMEM    0x0100 /* IT: need arpeggio memory */
  423. #define UF_FT2QUIRKS 0x0200 /* emulate some FT2 replay quirks */
  424.  
  425. typedef struct MODULE {
  426.     /* general module information */
  427.         CHAR*       songname;    /* name of the song */
  428.         CHAR*       modtype;     /* string type of module loaded */
  429.         CHAR*       comment;     /* module comments */
  430.  
  431.         UWORD       flags;       /* See module flags above */
  432.         UBYTE       numchn;      /* number of module channels */
  433.         UBYTE       numvoices;   /* max # voices used for full NNA playback */
  434.         UWORD       numpos;      /* number of positions in this song */
  435.         UWORD       numpat;      /* number of patterns in this song */
  436.         UWORD       numins;      /* number of instruments */
  437.         UWORD       numsmp;      /* number of samples */
  438. struct  INSTRUMENT* instruments; /* all instruments */
  439. struct  SAMPLE*     samples;     /* all samples */
  440.         UBYTE       realchn;     /* real number of channels used */
  441.         UBYTE       totalchn;    /* total number of channels used (incl NNAs) */
  442.  
  443.     /* playback settings */
  444.         UWORD       reppos;      /* restart position */
  445.         UBYTE       initspeed;   /* initial song speed */
  446.         UWORD       inittempo;   /* initial song tempo */
  447.         UBYTE       initvolume;  /* initial global volume (0 - 128) */
  448.         UWORD       panning[64]; /* 64 panning positions */
  449.         UBYTE       chanvol[64]; /* 64 channel positions */
  450.         UWORD       bpm;         /* current beats-per-minute speed */
  451.         UWORD       sngspd;      /* current song speed */
  452.         SWORD       volume;      /* song volume (0-128) (or user volume) */
  453.  
  454.         BOOL        extspd;      /* extended speed flag (default enabled) */
  455.         BOOL        panflag;     /* panning flag (default enabled) */
  456.         BOOL        wrap;        /* wrap module ? (default disabled) */
  457.         BOOL        loop;         /* allow module to loop ? (default enabled) */
  458.         BOOL        fadeout;     /* volume fade out during last pattern */
  459.  
  460.         UWORD       patpos;      /* current row number */
  461.         SWORD       sngpos;      /* current song position */
  462.         ULONG       sngtime;     /* current song time in 2^-10 seconds */
  463.  
  464.         SWORD       relspd;      /* relative speed factor */
  465.  
  466.     /* internal module representation */
  467.         UWORD       numtrk;      /* number of tracks */
  468.         UBYTE**     tracks;      /* array of numtrk pointers to tracks */
  469.         UWORD*      patterns;    /* array of Patterns */
  470.         UWORD*      pattrows;    /* array of number of rows for each pattern */
  471.         UWORD*      positions;   /* all positions */
  472.  
  473.         BOOL        forbid;      /* if true, no player update! */
  474.         UWORD       numrow;      /* number of rows on current pattern */
  475.         UWORD       vbtick;      /* tick counter (counts from 0 to sngspd) */
  476.         UWORD       sngremainder;/* used for song time computation */
  477.  
  478. struct MP_CONTROL*  control;     /* Effects Channel info (size pf->numchn) */
  479. struct MP_VOICE*    voice;       /* Audio Voice information (size md_numchn) */
  480.  
  481.         UBYTE       globalslide; /* global volume slide rate */
  482.         UBYTE       pat_repcrazy;/* module has just looped to position -1 */
  483.         UWORD       patbrk;      /* position where to start a new pattern */
  484.         UBYTE       patdly;      /* patterndelay counter (command memory) */
  485.         UBYTE       patdly2;     /* patterndelay counter (real one) */
  486.         SWORD       posjmp;      /* flag to indicate a jump is needed... */
  487. } MODULE;
  488.  
  489. /*
  490.  *    ========== Module loaders
  491.  */
  492.  
  493. struct MLOADER;
  494.  
  495. MIKMODAPI extern CHAR*   MikMod_InfoLoader(void);
  496. MIKMODAPI extern void    MikMod_RegisterAllLoaders(void);
  497. MIKMODAPI extern void    MikMod_RegisterLoader(struct MLOADER*);
  498.  
  499. MIKMODAPI extern struct MLOADER load_669; /* 669 and Extended-669 (by Tran/Renaissance) */
  500. MIKMODAPI extern struct MLOADER load_amf; /* DMP Advanced Module Format (by Otto Chrons) */
  501. MIKMODAPI extern struct MLOADER load_dsm; /* DSIK internal module format */
  502. MIKMODAPI extern struct MLOADER load_far; /* Farandole Composer (by Daniel Potter) */
  503. MIKMODAPI extern struct MLOADER load_gdm; /* General DigiMusic (by Edward Schlunder) */
  504. MIKMODAPI extern struct MLOADER load_it;  /* Impulse Tracker (by Jeffrey Lim) */
  505. MIKMODAPI extern struct MLOADER load_imf; /* Imago Orpheus (by Lutz Roeder) */
  506. MIKMODAPI extern struct MLOADER load_med; /* Amiga MED modules (by Teijo Kinnunen) */
  507. MIKMODAPI extern struct MLOADER load_m15; /* Soundtracker 15-instrument */
  508. MIKMODAPI extern struct MLOADER load_mod; /* Standard 31-instrument Module loader */
  509. MIKMODAPI extern struct MLOADER load_mtm; /* Multi-Tracker Module (by Renaissance) */
  510. MIKMODAPI extern struct MLOADER load_okt; /* Amiga Oktalyzer */
  511. MIKMODAPI extern struct MLOADER load_stm; /* ScreamTracker 2 (by Future Crew) */
  512. MIKMODAPI extern struct MLOADER load_stx; /* STMIK 0.2 (by Future Crew) */
  513. MIKMODAPI extern struct MLOADER load_s3m; /* ScreamTracker 3 (by Future Crew) */
  514. MIKMODAPI extern struct MLOADER load_ult; /* UltraTracker (by MAS) */
  515. MIKMODAPI extern struct MLOADER load_uni; /* MikMod and APlayer internal module format */
  516. MIKMODAPI extern struct MLOADER load_xm;  /* FastTracker 2 (by Triton) */
  517.  
  518. /*
  519.  *    ========== Module player
  520.  */
  521.  
  522. MIKMODAPI extern MODULE* Player_Load(CHAR*,int,BOOL);
  523. MIKMODAPI extern MODULE* Player_LoadFP(FILE*,int,BOOL);
  524. MIKMODAPI extern MODULE* Player_LoadGeneric(MREADER*,int,BOOL);
  525. MIKMODAPI extern CHAR*   Player_LoadTitle(CHAR*);
  526. MIKMODAPI extern CHAR*   Player_LoadTitleFP(FILE*);
  527. MIKMODAPI extern void    Player_Free(MODULE*);
  528. MIKMODAPI extern void    Player_Start(MODULE*);
  529. MIKMODAPI extern BOOL    Player_Active(void);
  530. MIKMODAPI extern void    Player_Stop(void);
  531. MIKMODAPI extern void    Player_TogglePause(void);
  532. MIKMODAPI extern BOOL    Player_Paused(void);
  533. MIKMODAPI extern void    Player_NextPosition(void);
  534. MIKMODAPI extern void    Player_PrevPosition(void);
  535. MIKMODAPI extern void    Player_SetPosition(UWORD);
  536. MIKMODAPI extern BOOL    Player_Muted(UBYTE);
  537. MIKMODAPI extern void    Player_SetVolume(SWORD);
  538. MIKMODAPI extern MODULE* Player_GetModule(void);
  539. MIKMODAPI extern void    Player_SetSpeed(UWORD);
  540. MIKMODAPI extern void    Player_SetTempo(UWORD);
  541. MIKMODAPI extern void    Player_Unmute(SLONG,...);
  542. MIKMODAPI extern void    Player_Mute(SLONG,...);
  543. MIKMODAPI extern void    Player_ToggleMute(SLONG,...);
  544. MIKMODAPI extern int     Player_GetChannelVoice(UBYTE);
  545. MIKMODAPI extern UWORD   Player_GetChannelPeriod(UBYTE);
  546.  
  547. typedef void (MikMod_player)(void);
  548. typedef MikMod_player *MikMod_player_t;
  549.  
  550. MIKMODAPI extern MikMod_player_t MikMod_RegisterPlayer(MikMod_player_t);
  551.  
  552. #define MUTE_EXCLUSIVE  32000
  553. #define MUTE_INCLUSIVE  32001
  554.  
  555. /*
  556.  *    ========== Drivers
  557.  */
  558.  
  559. enum {
  560.     MD_MUSIC = 0,
  561.     MD_SNDFX
  562. };
  563.  
  564. enum {
  565.     MD_HARDWARE = 0,
  566.     MD_SOFTWARE
  567. };
  568.  
  569. /* Mixing flags */
  570.  
  571. /* These ones take effect only after MikMod_Init or MikMod_Reset */
  572. #define DMODE_16BITS     0x0001 /* enable 16 bit output */
  573. #define DMODE_STEREO     0x0002 /* enable stereo output */
  574. #define DMODE_SOFT_SNDFX 0x0004 /* Process sound effects via software mixer */
  575. #define DMODE_SOFT_MUSIC 0x0008 /* Process music via software mixer */
  576. #define DMODE_HQMIXER    0x0010 /* Use high-quality (slower) software mixer */
  577. /* These take effect immediately. */
  578. #define DMODE_SURROUND   0x0100 /* enable surround sound */
  579. #define DMODE_INTERP     0x0200 /* enable interpolation */
  580. #define DMODE_REVERSE    0x0400 /* reverse stereo */
  581.  
  582. struct SAMPLOAD;
  583. typedef struct MDRIVER {
  584. struct MDRIVER* next;
  585.     CHAR*       Name;
  586.     CHAR*       Version;
  587.  
  588.     UBYTE       HardVoiceLimit; /* Limit of hardware mixer voices */
  589.     UBYTE       SoftVoiceLimit; /* Limit of software mixer voices */
  590.  
  591.     CHAR*       Alias;
  592.  
  593.     void        (*CommandLine)      (CHAR*);
  594.     BOOL        (*IsPresent)        (void);
  595.     SWORD       (*SampleLoad)       (struct SAMPLOAD*,int);
  596.     void        (*SampleUnload)     (SWORD);
  597.     ULONG       (*FreeSampleSpace)  (int);
  598.     ULONG       (*RealSampleLength) (int,struct SAMPLE*);
  599.     BOOL        (*Init)             (void);
  600.     void        (*Exit)             (void);
  601.     BOOL        (*Reset)            (void);
  602.     BOOL        (*SetNumVoices)     (void);
  603.     BOOL        (*PlayStart)        (void);
  604.     void        (*PlayStop)         (void);
  605.     void        (*Update)           (void);
  606.     void        (*Pause)            (void);
  607.     void        (*VoiceSetVolume)   (UBYTE,UWORD);
  608.     UWORD       (*VoiceGetVolume)   (UBYTE);
  609.     void        (*VoiceSetFrequency)(UBYTE,ULONG);
  610.     ULONG       (*VoiceGetFrequency)(UBYTE);
  611.     void        (*VoiceSetPanning)  (UBYTE,ULONG);
  612.     ULONG       (*VoiceGetPanning)  (UBYTE);
  613.     void        (*VoicePlay)        (UBYTE,SWORD,ULONG,ULONG,ULONG,ULONG,UWORD);
  614.     void        (*VoiceStop)        (UBYTE);
  615.     BOOL        (*VoiceStopped)     (UBYTE);
  616.     SLONG       (*VoiceGetPosition) (UBYTE);
  617.     ULONG       (*VoiceRealVolume)  (UBYTE);
  618. } MDRIVER;
  619.  
  620. /* These variables can be changed at ANY time and results will be immediate */
  621. MIKMODAPI extern UBYTE md_volume;      /* global sound volume (0-128) */
  622. MIKMODAPI extern UBYTE md_musicvolume; /* volume of song */
  623. MIKMODAPI extern UBYTE md_sndfxvolume; /* volume of sound effects */
  624. MIKMODAPI extern UBYTE md_reverb;      /* 0 = none;  15 = chaos */
  625. MIKMODAPI extern UBYTE md_pansep;      /* 0 = mono;  128 == 100% (full left/right) */
  626.  
  627. /* The variables below can be changed at any time, but changes will not be
  628.    implemented until MikMod_Reset is called. A call to MikMod_Reset may result
  629.    in a skip or pop in audio (depending on the soundcard driver and the settings
  630.    changed). */
  631. MIKMODAPI extern UWORD md_device;      /* device */
  632. MIKMODAPI extern UWORD md_mixfreq;     /* mixing frequency */
  633. MIKMODAPI extern UWORD md_mode;        /* mode. See DMODE_? flags above */
  634.  
  635. /* The following variable should not be changed! */
  636. MIKMODAPI extern MDRIVER* md_driver;   /* Current driver in use. */
  637.  
  638. /* Known drivers list */
  639.  
  640. MIKMODAPI extern struct MDRIVER drv_nos;    /* no sound */
  641. MIKMODAPI extern struct MDRIVER drv_pipe;   /* piped output */
  642. MIKMODAPI extern struct MDRIVER drv_raw;    /* raw file disk writer [music.raw] */
  643. MIKMODAPI extern struct MDRIVER drv_stdout; /* output to stdout */
  644. MIKMODAPI extern struct MDRIVER drv_wav;    /* RIFF WAVE file disk writer [music.wav] */
  645.  
  646. MIKMODAPI extern struct MDRIVER drv_ultra;  /* Linux Ultrasound driver */
  647. MIKMODAPI extern struct MDRIVER drv_sam9407;    /* Linux sam9407 driver */
  648.  
  649. MIKMODAPI extern struct MDRIVER drv_AF;     /* Dec Alpha AudioFile */
  650. MIKMODAPI extern struct MDRIVER drv_aix;    /* AIX audio device */
  651. MIKMODAPI extern struct MDRIVER drv_alsa;   /* Advanced Linux Sound Architecture (ALSA) */
  652. MIKMODAPI extern struct MDRIVER drv_esd;    /* Enlightened sound daemon (EsounD) */
  653. MIKMODAPI extern struct MDRIVER drv_hp;     /* HP-UX audio device */
  654. MIKMODAPI extern struct MDRIVER drv_oss;    /* OpenSound System (Linux,FreeBSD...) */
  655. MIKMODAPI extern struct MDRIVER drv_sgi;    /* SGI audio library */
  656. MIKMODAPI extern struct MDRIVER drv_sun;    /* Sun/NetBSD/OpenBSD audio device */
  657.  
  658. MIKMODAPI extern struct MDRIVER drv_dart;   /* OS/2 Direct Audio RealTime */
  659. MIKMODAPI extern struct MDRIVER drv_os2;    /* OS/2 MMPM/2 */
  660.  
  661. MIKMODAPI extern struct MDRIVER drv_ds;     /* Win32 DirectSound driver */
  662. MIKMODAPI extern struct MDRIVER drv_win;    /* Win32 multimedia API driver */
  663.  
  664. MIKMODAPI extern struct MDRIVER drv_mac;    /* Macintosh Sound Manager driver */
  665.  
  666. /*========== Virtual channel mixer interface (for user-supplied drivers only) */
  667.  
  668. MIKMODAPI extern BOOL  VC_Init(void);
  669. MIKMODAPI extern void  VC_Exit(void);
  670. MIKMODAPI extern BOOL  VC_SetNumVoices(void);
  671. MIKMODAPI extern ULONG VC_SampleSpace(int);
  672. MIKMODAPI extern ULONG VC_SampleLength(int,SAMPLE*);
  673.  
  674. MIKMODAPI extern BOOL  VC_PlayStart(void);
  675. MIKMODAPI extern void  VC_PlayStop(void);
  676.  
  677. MIKMODAPI extern SWORD VC_SampleLoad(struct SAMPLOAD*,int);
  678. MIKMODAPI extern void  VC_SampleUnload(SWORD);
  679.  
  680. MIKMODAPI extern ULONG VC_WriteBytes(SBYTE*,ULONG);
  681. MIKMODAPI extern ULONG VC_SilenceBytes(SBYTE*,ULONG);
  682.  
  683. MIKMODAPI extern void  VC_VoiceSetVolume(UBYTE,UWORD);
  684. MIKMODAPI extern UWORD VC_VoiceGetVolume(UBYTE);
  685. MIKMODAPI extern void  VC_VoiceSetFrequency(UBYTE,ULONG);
  686. MIKMODAPI extern ULONG VC_VoiceGetFrequency(UBYTE);
  687. MIKMODAPI extern void  VC_VoiceSetPanning(UBYTE,ULONG);
  688. MIKMODAPI extern ULONG VC_VoiceGetPanning(UBYTE);
  689. MIKMODAPI extern void  VC_VoicePlay(UBYTE,SWORD,ULONG,ULONG,ULONG,ULONG,UWORD);
  690.  
  691. MIKMODAPI extern void  VC_VoiceStop(UBYTE);
  692. MIKMODAPI extern BOOL  VC_VoiceStopped(UBYTE);
  693. MIKMODAPI extern SLONG VC_VoiceGetPosition(UBYTE);
  694. MIKMODAPI extern ULONG VC_VoiceRealVolume(UBYTE);
  695.  
  696. #ifdef __cplusplus
  697. }
  698. #endif
  699.  
  700. #endif
  701.  
  702. /* ex:set ts=4: */
  703.